package com.qpf.spring.cloud.web.admin.controller;

import com.qpf.spring.cloud.web.admin.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Controller
public class IndexController {
    private DemoService demoService;
    @Autowired
    public IndexController(DemoService demoService) {
        this.demoService = demoService;
    }
    @GetMapping("index")
    public String demo(@RequestParam(value = "message", required = false) String message, Map<String, Object> map) {
        map.put("msg", String.format("message: %s", demoService.demo(message)));
        return "index";
    }
}
